#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

class Solution {
public:

	static bool compare(int a, int b) {
		string s1 = to_string(a);
		string s2 = to_string(b);
		return s1 + s2 > s2 + s1;
	}

	string largestNumber(vector<int>& nums) {
		sort(nums.begin(), nums.end(), compare);
		string str = "";
		for (int i = 0; i < nums.size(); i++) {
			if (nums[i] != 0 || str[0] != '0') str += to_string(nums[i]);
		}
		return str;
	}
};

int main() {

}